package pers.wwz.study.springclloudfeign.serviceb.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

import static pers.wwz.study.springclloudfeign.serviceb.constant.Constants.LOGIN_TOKEN;

@Slf4j
@RestController
@RequestMapping("/serviceb")
public class ServicebController {

    @RequestMapping("/getUuid")
    public String getUuid(HttpServletRequest httpServletRequest){
        String loginToken = httpServletRequest.getHeader(LOGIN_TOKEN);
        log.info("serviceb获取请求头参数loginToken:{}",loginToken);
        return UUID.randomUUID().toString().replace("-","");
    }
}
